-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an environment variable and CLI option to enable/disable default caching #11142
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ae2e91e
to
950aad2
Compare
950aad2
to
9909574
Compare
Ready for review. |
3f7ab0d
to
41d6e19
Compare
…lt caching Signed-off-by: ddalvi <[email protected]>
41d6e19
to
6847162
Compare
/retest test-run-all-gcpc-modules |
@DharmitD: The
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Environment variable values should align with the conventions used by other Python libraries. Typically, 0 is used to represent false, while any other integer is treated as true. Although some approaches allow for more variation in representing true, such as accepting |
To @diegolovison 's point, I also noticed this in the compiler today. There's a strong argument to be made for keeping the user interface consistent. pipelines/sdk/python/kfp/cli/compile_.py Lines 131 to 135 in 1c7954d
@DharmitD , how difficult would it be to rework this using a Feature flag? |
Closing as this has been covered in #11222 |
Resolves #11092
Description of your changes:
An environment variable and a CLI option have been added to control whether task-level caching is enabled by default. The CLI flag
--execution-caching-enabled-by-default
takes precedence over the environment variableKFP_EXECUTION_CACHING_ENABLED_BY_DEFAULT
. Here's how it works:CLI Flag Precedence: If the
--execution-caching-enabled-by-default
flag is provided, it directly controls whether caching is enabled or disabled, setting the environment variable toenabled
ordisabled
accordingly.Environment Variable Fallback: If the CLI flag is not provided, the environment variable
KFP_EXECUTION_CACHING_ENABLED_BY_DEFAULT
determines the caching behavior. If this variable is set toenabled
, caching is enabled; if set todisabled
, caching is disabled.Default Behavior: If neither the CLI flag nor the environment variable is set, caching defaults to enabled.
Example Cases
Case 1: Default Behavior (No CLI Flag, No Environment Variable Set)
Command:
Environment Variable: Not set.
CLI Flag: Not provided.
Outcome: Caching is enabled by default (because the environment variable defaults to
enabled
).Case 2: Environment Variable Set to
enabled
, No CLI FlagCommand:
Environment Variable: Set to
enabled
.CLI Flag: Not provided.
Outcome: Caching is enabled.
Case 3: Environment Variable Set to
disabled
, No CLI FlagCommand:
Environment Variable: Set to
disabled
.CLI Flag: Not provided.
Outcome: Caching is disabled.
Case 4: CLI Flag Set to
enabled
, Environment Variable Set toenabled
Command:
Environment Variable: Set to
enabled
.CLI Flag: Set to
enabled
.Outcome: Caching is enabled because the CLI flag confirms it, and it takes precedence.
Case 5: CLI Flag Set to
disabled
, Environment Variable Set toenabled
Command:
Environment Variable: Set to
enabled
.CLI Flag: Set to
disabled
.Outcome: Caching is disabled because the CLI flag takes precedence over the environment variable.
Case 6: CLI Flag Set to
enabled
, Environment Variable Set todisabled
Command:
Environment Variable: Set to
disabled
.CLI Flag: Set to
enabled
.Outcome: Caching is enabled because the CLI flag takes precedence over the environment variable.
Case 7: CLI Flag Set to
disabled
, Environment Variable Set todisabled
Command:
Environment Variable: Set to
disabled
.CLI Flag: Set to
disabled
.Outcome: Caching is disabled because both the environment variable and CLI flag indicate that caching should be disabled.
Summary of Precedence and Outcomes
This logic provides flexibility while ensuring that the user’s explicit command-line instructions (the CLI flag) take precedence over environment settings.
Checklist: